#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/syscall.h>
int main()
{
    void fun_ctrl_c();
    (void)signal(SIGINT, fun_ctrl_c);
    printf("主程序：程序进入死循环.\n");
    while (1)
    {
        printf("死循环：按Ctrl+C退出.\n");
        sleep(3);
    }
    return 0;
}
void fun_ctrl_c()
{
    printf("\t你按了Ctrl+C哦 :)\n");
    printf("\t信号处理函数：有什么要处理在处理函数中编程!\n");
    printf("\t此例不处理，重新恢复SIGINT的系统默认处理!\n");
    (void)signal(SIGINT, SIG_DFL);
}